package com.study.model.pojo;

import java.io.Serializable;
import javax.persistence.*;
import java.math.BigDecimal;
import java.util.Date;
import java.util.List;


/**
 * The persistent class for the moneybackplan database table.
 * 
 */
@Entity
@NamedQuery(name="Moneybackplan.findAll", query="SELECT m FROM Moneybackplan m")
public class Moneybackplan implements Serializable {
	private static final long serialVersionUID = 1L;

	@Id
	@Column(name="mb_plan")
	private int mbPlan;

	@Temporal(TemporalType.DATE)
	@Column(name="mb_date")
	private Date mbDate;

	@Column(name="mb_desc")
	private String mbDesc;

	@Column(name="mb_moneys")
	private BigDecimal mbMoneys;

	@Column(name="mb_percentage")
	private BigDecimal mbPercentage;

	@Column(name="mb_type")
	private byte mbType;

	@Column(name="us_id")
	private int usId;

	//bi-directional many-to-one association to Dictionary
	@ManyToOne
	@JoinColumn(name="mb_period")
	private Dictionary dictionary;

	//bi-directional many-to-one association to Orderdetail
	@ManyToOne
	@JoinColumn(name="od_id")
	private Orderdetail orderform;

	//bi-directional many-to-one association to Paymentrecord
	@OneToMany(mappedBy="moneybackplan")
	private List<Paymentrecord> paymentrecords;

	public Moneybackplan() {
	}

	public int getMbPlan() {
		return this.mbPlan;
	}

	public void setMbPlan(int mbPlan) {
		this.mbPlan = mbPlan;
	}

	public Date getMbDate() {
		return this.mbDate;
	}

	public void setMbDate(Date mbDate) {
		this.mbDate = mbDate;
	}

	public String getMbDesc() {
		return this.mbDesc;
	}

	public void setMbDesc(String mbDesc) {
		this.mbDesc = mbDesc;
	}

	public BigDecimal getMbMoneys() {
		return this.mbMoneys;
	}

	public void setMbMoneys(BigDecimal mbMoneys) {
		this.mbMoneys = mbMoneys;
	}

	public BigDecimal getMbPercentage() {
		return this.mbPercentage;
	}

	public void setMbPercentage(BigDecimal mbPercentage) {
		this.mbPercentage = mbPercentage;
	}

	public byte getMbType() {
		return this.mbType;
	}

	public void setMbType(byte mbType) {
		this.mbType = mbType;
	}

	public int getUsId() {
		return this.usId;
	}

	public void setUsId(int usId) {
		this.usId = usId;
	}

	public Dictionary getDictionary() {
		return this.dictionary;
	}

	public void setDictionary(Dictionary dictionary) {
		this.dictionary = dictionary;
	}



	public List<Paymentrecord> getPaymentrecords() {
		return this.paymentrecords;
	}

	public void setPaymentrecords(List<Paymentrecord> paymentrecords) {
		this.paymentrecords = paymentrecords;
	}

	public Paymentrecord addPaymentrecord(Paymentrecord paymentrecord) {
		getPaymentrecords().add(paymentrecord);
		paymentrecord.setMoneybackplan(this);

		return paymentrecord;
	}

	public Paymentrecord removePaymentrecord(Paymentrecord paymentrecord) {
		getPaymentrecords().remove(paymentrecord);
		paymentrecord.setMoneybackplan(null);

		return paymentrecord;
	}

}